//
//  ChatBlackCell.m
//  WanCaiC8
//
//  Created by tangang on 2018/4/13.
//  Copyright © 2018年 tangang. All rights reserved.
//

#import "ChatBlackCell.h"

@implementation ChatBlackCell{
    UIImageView     *headImageV;
    QXLable         *labName;
    UIButton        *btnRemove;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle=UITableViewCellSeparatorStyleNone;
        headImageV=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"avatar"]];
        headImageV.layer.masksToBounds=YES;
        headImageV.layer.cornerRadius=16.5;
        [self.contentView addSubview:headImageV];
        [headImageV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).with.offset(10);
            make.centerY.equalTo(self.contentView);
            make.size.mas_equalTo(CGSizeMake(33, 33));
        }];
        
        labName=[[QXLable alloc]init];
        [self.contentView addSubview:labName];
        [labName mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(headImageV.mas_right).with.offset(10);
            make.centerY.equalTo(self.contentView);
            make.size.mas_equalTo(CGSizeMake(200, 50));
        }];
        
        btnRemove =[[UIButton alloc]init];
        [btnRemove addTarget:self action:@selector(onclockRemove) forControlEvents:UIControlEventTouchUpInside];
        [btnRemove setTitle:@"解除" forState:UIControlStateNormal];
        [btnRemove setTitleColor:DEFAULTTEXTGRAYCOLOR forState:UIControlStateNormal];
        [btnRemove.titleLabel setFont:[UIFont systemFontOfSize:13]];
        btnRemove.layer.masksToBounds=YES;
        btnRemove.layer.borderWidth=.7;
        btnRemove.layer.borderColor=DEFAULTTEXTGRAYCOLOR.CGColor;
        btnRemove.layer.cornerRadius=3;
        [self.contentView addSubview:btnRemove];
        [btnRemove mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.contentView);
            make.right.equalTo(self.contentView).with.offset(-10);
            make.size.mas_equalTo(CGSizeMake(52, 25));
        }];
        
    }
    return self;
}

- (void)setModel:(BlackPeopleModel *)model{
    labName.text=model.UserName;
    [headImageV sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",model.PhotoImg]] placeholderImage:[UIImage imageNamed:@"avatar"]];
    
}

- (void)onclockRemove{
    if (self.removeBlock) {
        self.removeBlock();
    }
}

@end
